package com.cskaoyan.shopping.converter;

import com.cskaoyan.shopping.dal.entitys.Item;
import com.cskaoyan.shopping.dal.entitys.PanelContent;
import com.cskaoyan.shopping.dal.entitys.PanelContentItem;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper(componentModel = "spring")
public interface PanelConverter {

    @Mappings({
            @Mapping(source = "panelContent.id",target = "id"),
            @Mapping(source = "panelContent.created",target = "created"),
            @Mapping(source = "panelContent.updated",target = "updated"),
            @Mapping(source = "item.title",target = "productName"),
            @Mapping(source = "item.price",target = "salePrice"),
            @Mapping(source = "item.sell_point",target = "subTitle")
    })
    PanelContentItem panelContentItems(PanelContent panelContent, Item item);

}